﻿#define MAX_COMMAND_LENGTH 200          /*Max length of command*/
#define MAX_NUMBER_LENGTH 6             /*Max length of car number or time*/
#define ERROR 0
#define OVERFLOW -1
#define OK 1
typedef int Status;

typedef struct {
	int plate;
	int time;
}car;
typedef car SElemType,QElemType;

typedef struct{
	SElemType * base;
	SElemType * top;
	int stacksize;
}	Stack;
Status initStack(Stack *s, int size);
Status getTop(Stack *s,SElemType *e);
Status push(Stack *s,SElemType e);
Status pop(Stack *s,SElemType *e);
Status stackEmpty(Stack s);
int stackLength(Stack s);
Status clearStack(Stack *s);
Status fullStack(Stack s);

typedef struct qnode{
	SElemType data;
	struct qnode *next;
}	QN,*QP;
typedef struct{
	QP front;	
	QP rear;
}	LQ;
Status initq(LQ *q);
Status dstrq(LQ *q);
Status enq(LQ *q,QElemType e);
Status delq(LQ *q, QElemType *e);


void rs(char *b, int price);
void error(int tag);
void carIn(int num,int time);
void carOut(int num,int time, int price);
void showStop();
void showSidewalk(LQ q);

LQ sidewalk;
Stack stop,tmp;